#ifndef _HESAI_SDK_H_
#define _HESAI_SDK_H_
#pragma once

#include "modules/drivers/lidar/orin_hesai/common/data_type.h"
#include "modules/drivers/lidar/orin_hesai/common/make_time.h"
#include "modules/drivers/lidar/orin_hesai/hesai_utils/hesai_data_type.h"
#include "modules/drivers/lidar/orin_hesai/hesai_utils/socket_input.h"
#include "modules/drivers/lidar/orin_hesai/proto/lidar_hesai_config.pb.h"

namespace apollo {
namespace drivers {
namespace lidar_hesai {

class HesaiSDK {
 public:
  bool Init(const uint32_t firing_data_port);
  bool Init(::apollo::drivers::lidar_hesai::Config& config);
  void SetDataCallBack(HesaiLidarDataCallBack cb);
  void Start();

  uint64_t GetPacketTimestamp(const HesaiLidarPacketData &buf);
  void CheckHighTemperature(const HesaiLidarPacketData &buf);

 private:
  bool GetPacket();

 private:
  LidarPacket packet_buffer_;
  HesaiLidarDataCallBack cb_;
  std::shared_ptr<SocketInput> input_;
  MakeTime* const make_time_{MakeTime::Instance()};
};
}  // namespace lidar_hesai
}  // namespace drivers
}  // namespace apollo

#endif
